package ldh.im.fxbase.data.pojo.status;

import ldh.rpc.dto.ValueEnum;
import ldh.im.dto.enums.GroupStatus;

public enum ImGroupStatus implements ValueEnum<Byte> {
    none((byte)-1, "空"),
    enable((byte)1, "有效"),
    disable((byte)2, "无效"),
    dissolution((byte)3, "解散"),
    prohibition((byte)4, "禁言"),
    ;

    private Byte value;
    private String desc;

    private ImGroupStatus(Byte value, String desc){
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static ImGroupStatus getByValue(Integer value) {
        if (value == null) return null;
        for (ImGroupStatus groupType : ImGroupStatus.values()) {
            if (groupType.getValue() == value.byteValue()) {
                return groupType;
            }
        }

        throw new RuntimeException("ImGroupStatus不支持这个值：" + value);
    }

    public static ImGroupStatus wrap(GroupStatus groupStatus) {
        return ImGroupStatus.valueOf(groupStatus.name());
    }
}
